package com.snut.tomorrowNews.service.front;

import com.snut.tomorrowNews.dao.front.WebmsgDao;
import com.snut.tomorrowNews.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;

/**
 * @author 何文强
 */
@Service
public class WegmsgService {
    @Autowired
    WebmsgDao webmsgDao;
    @Transactional
    public Webmsg select(){
        return webmsgDao.Webmsg();
    }


    public void uploadlogo(Webmsg webmsg) {
        webmsgDao.uploadlogo(webmsg);
    }
//新闻类型
    public List<Webmsg> newtypeselect() {
        return webmsgDao.Newstype();
    }

    public List<Webmsg> linksselect() {
        return webmsgDao.linksselect();
    }
//根据id查内容
    public List<News> newtype(Integer id) {
        return webmsgDao.newstypeid(id);
    }

    public List<News> search(String searchname) {
        return webmsgDao.searchnews(searchname);
    }

    public List<News> newnewstype() {
        return webmsgDao.newsnewstype();
    }

    public List<Admsg> admsg() {
        return webmsgDao.admsg();
    }

    public News newidselect(Integer id) {
        return webmsgDao.newid(id);
    }

    public void collect(Integer userId, Integer newsId) {
        System.out.println(userId);
        System.out.println(newsId);
        webmsgDao.collect(userId, newsId);
    }

    public List<News> recommend() {
       return webmsgDao.recommend();
    }

    public List<News> click() {
        return webmsgDao.click();
    }

    public void clicknum(Integer aid,Integer rid) {
        webmsgDao.clicknum(aid,rid);
    }

    public void deleteadmsg(Integer id) {
        webmsgDao.deleteadmsg(id);
    }

    public Admsg findadmsg(Integer id) {
       return webmsgDao.findadmsg(id);
    }

    public void uploadadmsg(Admin admin) {
        webmsgDao.uploadadmsg(admin);
    }

    public void deletelink(Integer id) {
        webmsgDao.deletelink(id);
    }

    public Webmsg findlink(Integer id) {
       return webmsgDao.findlink(id);
    }

    public void savelink(Webmsg webmsg) {
         webmsgDao.savelink(webmsg);
    }

    public void save1link(Webmsg webmsg) {
        webmsgDao.save1link(webmsg);
    }

    public News findnewstype(Integer id) {
        return webmsgDao.findnewstype(id);
    }

    public void deletenewstype(Integer id) {
         webmsgDao.deletenewstype(id);
    }

    public void savenewstype(News news) {
        webmsgDao.savenewstype(news);
    }

    public void save1newstype(NewsType newsType) {
        webmsgDao.save1newstype(newsType);
    }

    public void savewebmsg(Webmsg webmsg) {
        webmsgDao.savewebmsg(webmsg);
    }

    public void saveadmsg(Admsg admsg) {
        webmsgDao.saveadmsg(admsg);
    }
}
